package com.wu01.demo.newdemo.demo;

/**
 * @author wubingcang
 * @desc
 * @date 2024年04月21日 17:18
 */
// 父类
public class Animal {
    public static void testClassMethod() {
        System.out.println("The static method in Animal");
    }
    public void testInstanceMethod() {
        System.out.println("The instance method in Animal");
    }
}

// 子类
class Cat extends Animal {
    public static void testClassMethod() {
        System.out.println("The static method in Cat");
    }
    public void testInstanceMethod() {
        System.out.println("The instance method in Cat");
    }

    public static void main(String[] args) {
        Cat myCat = new Cat();
        Animal myAnimal = myCat;
        Animal.testClassMethod(); // 使用父类调用静态方法
        Cat.testClassMethod();
        myAnimal.testInstanceMethod();
    }
}
